<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotModelanalyse extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELANALYSE;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_NOMMODEL;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_XMTTEXT;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_PILOTPLATEFORMEIdPILOTPLATEFORME;


    /**
     * Parent relation fk_PILOT_MODELANALYSE_PILOT_PLATEFORME1
     *
     * @var Application_Model_PilotPlateforme
     */
    protected $_PilotPlateforme;


    /**
     * Dependent relation fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELANALYSE1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotModelactiviteanalyse
     */
    protected $_PilotModelactiviteanalyse;

    /**
     * Dependent relation fk_PILOT_PROJETANALYSE_PILOT_MODELANALYSE1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotProjetanalyse
     */
    protected $_PilotProjetanalyse;

    /**
     * Dependent relation fk_PILOT_REQUEST_PILOT_MODELANALYSE10
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotRequest
     */
    protected $_PilotRequest;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_MODELANALYSE'=>'IdPILOTMODELANALYSE',
            'NOMMODEL'=>'NOMMODEL',
            'XMTTEXT'=>'XMTTEXT',
            'PILOT_PLATEFORME_idPILOT_PLATEFORME'=>'PILOTPLATEFORMEIdPILOTPLATEFORME',
        ));

        $this->setParentList(array(
            'FkPILOTMODELANALYSEPILOTPLATEFORME1'=> array(
                    'property' => 'PilotPlateforme',
                    'table_name' => 'PilotPlateforme',
                ),
        ));

        $this->setDependentList(array(
            'FkPILOTMODELACTIVITEANALYSEPILOTMODELANALYSE1' => array(
                    'property' => 'PilotModelactiviteanalyse',
                    'table_name' => 'PilotModelactiviteanalyse',
                ),
            'FkPILOTPROJETANALYSEPILOTMODELANALYSE1' => array(
                    'property' => 'PilotProjetanalyse',
                    'table_name' => 'PilotProjetanalyse',
                ),
            'FkPILOTREQUESTPILOTMODELANALYSE10' => array(
                    'property' => 'PilotRequest',
                    'table_name' => 'PilotRequest',
                ),
        ));
    }

    /**
     * Sets column idPILOT_MODELANALYSE
     *
     * @param string $data
     * @return Application_Model_PilotModelanalyse
     */
    public function setIdPILOTMODELANALYSE($data)
    {
        $this->_IdPILOTMODELANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELANALYSE
     *
     * @return string
     */
    public function getIdPILOTMODELANALYSE()
    {
        return $this->_IdPILOTMODELANALYSE;
    }

    /**
     * Sets column NOMMODEL
     *
     * @param string $data
     * @return Application_Model_PilotModelanalyse
     */
    public function setNOMMODEL($data)
    {
        $this->_NOMMODEL = $data;
        return $this;
    }

    /**
     * Gets column NOMMODEL
     *
     * @return string
     */
    public function getNOMMODEL()
    {
        return $this->_NOMMODEL;
    }

    /**
     * Sets column XMTTEXT
     *
     * @param text $data
     * @return Application_Model_PilotModelanalyse
     */
    public function setXMTTEXT($data)
    {
        $this->_XMTTEXT = $data;
        return $this;
    }

    /**
     * Gets column XMTTEXT
     *
     * @return text
     */
    public function getXMTTEXT()
    {
        return $this->_XMTTEXT;
    }

    /**
     * Sets column PILOT_PLATEFORME_idPILOT_PLATEFORME
     *
     * @param string $data
     * @return Application_Model_PilotModelanalyse
     */
    public function setPILOTPLATEFORMEIdPILOTPLATEFORME($data)
    {
        $this->_PILOTPLATEFORMEIdPILOTPLATEFORME = $data;
        return $this;
    }

    /**
     * Gets column PILOT_PLATEFORME_idPILOT_PLATEFORME
     *
     * @return string
     */
    public function getPILOTPLATEFORMEIdPILOTPLATEFORME()
    {
        return $this->_PILOTPLATEFORMEIdPILOTPLATEFORME;
    }

    /**
     * Sets parent relation PILOTPLATEFORMEIdPILOTPLATEFORME
     *
     * @param Application_Model_PilotPlateforme $data
     * @return Application_Model_PilotModelanalyse
     */
    public function setPilotPlateforme(Application_Model_PilotPlateforme $data)
    {
        $this->_PilotPlateforme = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_PLATEFORME'];
        }

        $this->setPILOTPLATEFORMEIdPILOTPLATEFORME($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTPLATEFORMEIdPILOTPLATEFORME
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotPlateforme
     */
    public function getPilotPlateforme($load = true)
    {
        if ($this->_PilotPlateforme === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTMODELANALYSEPILOTPLATEFORME1', $this);
        }

        return $this->_PilotPlateforme;
    }

    /**
     * Sets dependent relations fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELANALYSE1
     *
     * @param array $data An array of Application_Model_PilotModelactiviteanalyse
     * @return Application_Model_PilotModelanalyse
     */
    public function setPilotModelactiviteanalyse(array $data)
    {
        $this->_PilotModelactiviteanalyse = array();

        foreach ($data as $object) {
            $this->addPilotModelactiviteanalyse($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELANALYSE1
     *
     * @param Application_Model_PilotModelactiviteanalyse $data
     * @return Application_Model_PilotModelanalyse
     */
    public function addPilotModelactiviteanalyse(Application_Model_PilotModelactiviteanalyse $data)
    {
        $this->_PilotModelactiviteanalyse[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELANALYSE1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotModelactiviteanalyse
     */
    public function getPilotModelactiviteanalyse($load = true)
    {
        if ($this->_PilotModelactiviteanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTMODELACTIVITEANALYSEPILOTMODELANALYSE1', $this);
        }

        return $this->_PilotModelactiviteanalyse;
    }

    /**
     * Sets dependent relations fk_PILOT_PROJETANALYSE_PILOT_MODELANALYSE1
     *
     * @param array $data An array of Application_Model_PilotProjetanalyse
     * @return Application_Model_PilotModelanalyse
     */
    public function setPilotProjetanalyse(array $data)
    {
        $this->_PilotProjetanalyse = array();

        foreach ($data as $object) {
            $this->addPilotProjetanalyse($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_PROJETANALYSE_PILOT_MODELANALYSE1
     *
     * @param Application_Model_PilotProjetanalyse $data
     * @return Application_Model_PilotModelanalyse
     */
    public function addPilotProjetanalyse(Application_Model_PilotProjetanalyse $data)
    {
        $this->_PilotProjetanalyse[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_PROJETANALYSE_PILOT_MODELANALYSE1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotProjetanalyse
     */
    public function getPilotProjetanalyse($load = true)
    {
        if ($this->_PilotProjetanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTPROJETANALYSEPILOTMODELANALYSE1', $this);
        }

        return $this->_PilotProjetanalyse;
    }

    /**
     * Sets dependent relations fk_PILOT_REQUEST_PILOT_MODELANALYSE10
     *
     * @param array $data An array of Application_Model_PilotRequest
     * @return Application_Model_PilotModelanalyse
     */
    public function setPilotRequest(array $data)
    {
        $this->_PilotRequest = array();

        foreach ($data as $object) {
            $this->addPilotRequest($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_REQUEST_PILOT_MODELANALYSE10
     *
     * @param Application_Model_PilotRequest $data
     * @return Application_Model_PilotModelanalyse
     */
    public function addPilotRequest(Application_Model_PilotRequest $data)
    {
        $this->_PilotRequest[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_REQUEST_PILOT_MODELANALYSE10
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotRequest
     */
    public function getPilotRequest($load = true)
    {
        if ($this->_PilotRequest === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTREQUESTPILOTMODELANALYSE10', $this);
        }

        return $this->_PilotRequest;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotModelanalyse
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotModelanalyse());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotModelanalyse::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTMODELANALYSE() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_MODELANALYSE = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTMODELANALYSE()));
    }
}
